const mongoose = require("mongoose");
const ordersSchema = new mongoose.Schema({//创建骨架
    userId: { type: mongoose.Schema.Types.ObjectId, ref: "users" },           // 订单所属用户 id
    orderGoodsId: [{ type: mongoose.Schema.Types.ObjectId, ref: "orderGoods" }],   // 订单商品 id
    time: String,               // 下单时间
    state: String,              // 订单状态（待付款/待收货/待评价...）
}, { versionKey: false });
//根据骨架创建模板
const ordersModel = mongoose.model('orders', ordersSchema, "orders");